import vnode from './vnode.js';

export default function h(tag, props, children) {
  if (arguments.length < 3) throw Error('arguments.length < 3');
  if (typeof children === 'string' || typeof children === 'number') {
    return vnode(tag, props, undefined, children, undefined);
  } else if (Array.isArray(children)) {
    return vnode(tag, props, children, undefined, undefined);
  } else if (typeof children === 'object') {
    return vnode(tag, props, [children], undefined, undefined);
  } else {
    throw new Error('第三个参数类型不对');
  }
}
